/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.colegiatura.bc;

import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.cip.esymons.colegiatura.be.GuiaRemision;

/**
 *
 * @author ADMINISTRADOR
 */
public class GuiaRemisionDelegate {

    private GuiaRemisionFacadeLocal local;

    public GuiaRemisionDelegate() {

        local = lookupGuiaRemisionFacade();
    }

    public void create(GuiaRemision guiaRemision){

        local.create(guiaRemision);
    }

    public void edit(GuiaRemision guiaRemision){

        local.edit(guiaRemision);
    }

    public void remove(GuiaRemision guiaRemision){

        local.remove(guiaRemision);
    }

    public GuiaRemision find(Object id){

        return local.find(id);
    }

    public List<GuiaRemision> findAll(){

        return local.findAll();
    }

    public Long buscaUltimo(){

        return local.buscaUltimo();
    }

    public GuiaRemision buscaGuia(Integer guia){

        return local.buscaGuia(guia);
    }

    public GuiaRemision buscaGuia(Long numero){

        return local.buscarNroGuia(numero);
    }
    
    private GuiaRemisionFacadeLocal lookupGuiaRemisionFacade() {
        try {
            Context c = new InitialContext();
            return (GuiaRemisionFacadeLocal) c.lookup("java:comp/env/GuiaRemisionFacade");
        } catch (NamingException ne) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
            throw new RuntimeException(ne);
        }
    }



}
